package me.zk.practice1;

import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;

import java.text.MessageFormat;
import java.util.List;
import java.util.Map;

/**
 * @Author: zhang kai
 * @Date: 2023/04/14
 * @Description:
 */
public class MockExcel {
    public static void main(String[] args) {
        ExcelReader reader = ExcelUtil.getReader("/Users/zhangkai/Downloads/1.xlsx");
        String insertSql = "INSERT INTO AUTHORIZED_DEPT_TAG (AUTHORIZED_DEPT_TAG_ID,AUTHORIZED_DEPT_INFO_ID,DEPT_ID,TAG_NAME,TAG_ID,WECHAT_TAG_DOC,SMS_TAG_DOC,TAG_MSG_TYPE,ENABLE_FLAG,SEQ,HOSPITAL_SOID,IS_DEL,CREATED_AT,MODIFIED_AT) VALUES ";

        List<Map<String,Object>> readAll = reader.readAll();
        Long id = 289997280557578240L;
        Integer tadId= 399630438;
        String delStr = "delete from AUTHORIZED_DEPT_TAG adt where adt .AUTHORIZED_DEPT_TAG_ID in (";
        StringBuffer delIds = new StringBuffer(delStr);
        for (Map<String,Object> map : readAll) {
            id += 1;
            tadId+=1;
            StringBuilder sb = new StringBuilder("(");
            sb.append(String.valueOf(id)+",");
            sb.append("289994907588147200,");
            sb.append("262203872879953922,");
            String tagName= "'" + map.get("模块标签").toString()+"'";
            sb.append(tagName + ",");
            sb.append(String.valueOf(tadId) + ",");
            sb.append("'',");
            String content = "'" + map.get("短信内容").toString().replace("【深圳恒生】","") +  map.get("短链接").toString()+"'" ;
            sb.append(content + ",");
            sb.append("'SMS',98175,0,993749,0,'2023-04-13 11:15:07','2023-04-13 11:15:07'),");
            delIds.append(id+",");
           System.out.println(sb);
        }
        System.out.print(";");
        System.out.println(delIds+");");
    }
}
